<?php
/**
 * @annotate 后台企业管理
 * @group   Admin/Haiyin
 * @author   yachtxiao <fuck@fackyou.org>
 */
class ApplyAction extends BaseAction {
	protected $aVerify = array(
   	'list'
  	);//需要验证的方法
	public function apply_list(){
		$list = D('company_apply')->order('ctime desc')->findpage(20);
		foreach ($list['data'] as $k => &$v) {
			$v['logo'] = get_img_url($v['logo']);
			$v['people'] =D('company_apply_people')->where('aid ='.$v['aid'])->count();
		}
		$this->assign('list',$list);
		$this->display();
	}
	public function apply_people_list(){
		$list = D('company_apply_people')->order('ctime desc')->findpage(20);
		foreach ($list['data'] as $k => &$v) {
			$v['title'] =D('company_apply')->where('aid ='.$v['aid'])->getField('title');
		}
		$this->assign('list',$list);
		$this->display();
	}
	public function list_nopass(){
		$list = D('company_apply')->where('status = 0 AND is_del = 0')->order('ctime desc')->findpage(20);
		foreach ($list['data'] as $k => &$v) {
			$v['logo'] = get_img_url($v['logo']);
			$v['people'] =D('company_apply_people')->where('aid ='.$v['aid'])->count();
		}
		$this->assign('list',$list);
		$this->display();
	}
	public function  edit_apply_status(){
		$map['aid'] = $_POST['id'];
		$data['status'] = $_POST['val'];
		$data['ctime'] = time();
		$da = D('company_apply')->where($map)->save($data);
		if($da){
			$this->ajaxReturn('','success',1);
		}else{
			$this->ajaxReturn('','error',0);
		}
	}
	public function  del_apply(){
		$map['aid'] = $_POST['id'];
		$data['is_del'] = 1;
		$da = D('company_apply')->where($map)->save($data);
		if($da){
			$this->ajaxReturn('','success',1);
		}else{
			$this->ajaxReturn('','error',0);
		}
	}
	
}
?>